
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2. 跑 laravel 的 hello world · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="3.html" />
    
    
    <link rel="prev" href="1.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">内容</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    0. 介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="1.html">
            
                <a href="1.html">
            
                    
                    1. php 开发环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3" data-path="2.html">
            
                <a href="2.html">
            
                    
                    2. 跑 laravel 的 hello world
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="3.html">
            
                <a href="3.html">
            
                    
                    3. 第一个路由 UsersController
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="4.html">
            
                <a href="4.html">
            
                    
                    4. 在数据库中创建一条数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="5.html">
            
                <a href="5.html">
            
                    
                    5. 简单的用户认证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="6.html">
            
                <a href="6.html">
            
                    
                    6. 修改 User model
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="7.html">
            
                <a href="7.html">
            
                    
                    7. User model 的 getter 方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="8.html">
            
                <a href="8.html">
            
                    
                    8. view 的更多知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="9.html">
            
                <a href="9.html">
            
                    
                    9. 在 view 中共享变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="10.html">
            
                <a href="10.html">
            
                    
                    10. blade layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="11.html">
            
                <a href="11.html">
            
                    
                    11. 使用 @include 来整理 view
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="12.html">
            
                <a href="12.html">
            
                    
                    12. Blade if/else/unless/or
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="13.html">
            
                <a href="13.html">
            
                    
                    13. factories, faker and seeding
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="14.html">
            
                <a href="14.html">
            
                    
                    14. Blade foreach
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">其他</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="laravel_vim.html">
            
                <a href="laravel_vim.html">
            
                    
                    VIM 的 laravel 插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="laravel_code_vim.html">
            
                <a href="laravel_code_vim.html">
            
                    
                    VIM 中有效地查看 php 源码
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2. 跑 laravel 的 hello world</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <blockquote>
<p>2017.08.09 &#x91CD;&#x65B0;&#x6574;&#x7406;</p>
</blockquote>
<p>&#x4E0A;&#x4E00;&#x7BC7;&#x7B14;&#x8BB0;<a href="https://www.rails365.net/articles/ruby-cheng-xu-yuan-xue-xi-laravel-kuang-jia-bi-ji-1-php-kai-fa-huan-jing-an" target="_blank">Ruby &#x7A0B;&#x5E8F;&#x5458;&#x5B66;&#x4E60; laravel &#x6846;&#x67B6;&#x7B14;&#x8BB0; (1)-php &#x5F00;&#x53D1;&#x73AF;&#x5883;&#x5B89;&#x88C5;</a>&#x8BB2;&#x4E86;&#x5173;&#x4E8E;php&#x73AF;&#x5883;&#x7684;&#x5B89;&#x88C5;&#xFF0C;&#x8FD9;&#x7BC7;&#x6765;&#x8BB2;&#x8BB2;&#x5982;&#x4F55;&#x5B89;&#x88C5;laravel&#xFF0C;&#x5E76;&#x628A;&#x5B83;&#x7684;hello world&#x8DD1;&#x8D77;&#x6765;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x8DDF;&#x4ECE;&#x5B98;&#x65B9;&#x7684;&#x6587;&#x6863;&#x6307;&#x5F15;&#x4E00;&#x6B65;&#x6B65;&#x6765;&#x64CD;&#x4F5C;&#x3002;</p>
<p><a href="https://laravel.com/docs/5.4" target="_blank">https://laravel.com/docs/5.4</a></p>
<h2 id="1-&#x5B89;&#x88C5;laravel">1. &#x5B89;&#x88C5;laravel</h2>
<p>&#x4E00;&#x6761;&#x547D;&#x4EE4;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#x3002;</p>
<pre><code class="lang-bash">composer global require <span class="hljs-string">&quot;laravel/installer&quot;</span>
</code></pre>
<p><img src="https://rails365.oss-cn-shenzhen.aliyuncs.com/uploads/photo/image/261/2017/c4848296719b3984724d4835948de6d5.png" alt=""></p>
<p>&#x8FD9;&#x6837;&#x5C31;&#x80FD;&#x6210;&#x529F;&#x5B89;&#x88C5;laravel&#x6846;&#x67B6;&#x3002;</p>
<h2 id="2-&#x751F;&#x6210;&#x9879;&#x76EE;">2. &#x751F;&#x6210;&#x9879;&#x76EE;</h2>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x8981;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x5168;&#x65B0;&#x7684;&#x9879;&#x76EE;&#x3002;</p>
<pre><code class="lang-bash">laravel new blog
</code></pre>
<p><img src="https://rails365.oss-cn-shenzhen.aliyuncs.com/uploads/photo/image/266/2017/4b107ef16076e714e8ec8021753b49e4.png" alt=""></p>
<p>&#x4F1A;&#x5728;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x53EB;<code>blog</code>&#x7684;&#x76EE;&#x5F55;&#xFF0C;&#x91CC;&#x9762;&#x5305;&#x542B;&#x4E86;laravel&#x9879;&#x76EE;&#x7684;&#x57FA;&#x672C;&#x4EE3;&#x7801;&#x3002;</p>
<h2 id="3-&#x542F;&#x52A8;&#x9879;&#x76EE;">3. &#x542F;&#x52A8;&#x9879;&#x76EE;</h2>
<p>&#x8FDB;&#x5165;&#x8FD9;&#x4E2A;&#x524D;&#x9762;&#x751F;&#x6210;&#x7684;&#x9879;&#x76EE;&#x76EE;&#x5F55;&#x3002;</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> blog
</code></pre>
<p>&#x7528;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#x542F;&#x52A8;&#x8BE5;&#x9879;&#x76EE;&#x3002;</p>
<pre><code class="lang-bash">php artisan serve
</code></pre>
<p><img src="https://rails365.oss-cn-shenzhen.aliyuncs.com/uploads/photo/image/267/2017/89d1b27ec92e99480ca934ce4a6df553.png" alt=""></p>
<p>&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x8DD1;&#x8D77;&#x6765;&#x4E86;&#x3002;</p>
<p>&#x7A0B;&#x5E8F;&#x76D1;&#x542C;&#x5728;8000&#x7AEF;&#x53E3;&#xFF0C;&#x7528;&#x6D4F;&#x89C8;&#x5668;&#x8FD0;&#x884C;&#x3002;</p>
<p><img src="https://rails365.oss-cn-shenzhen.aliyuncs.com/uploads/photo/image/268/2017/499e8f2889d116dab606a456e0e62de6.png" alt=""></p>
<p>&#x81F3;&#x6B64;&#xFF0C;hello world&#x5C31;&#x8DD1;&#x8D77;&#x6765;&#x4E86;&#x3002;</p>
<p>&#x5B8C;&#x7ED3;&#x3002;</p>
<p>&#x4E0B;&#x4E00;&#x7BC7;&#xFF1A;<a href="https://www.rails365.net/articles/ruby-cheng-xu-yuan-xue-xi-laravel-kuang-jia-bi-ji-3-di-yi-ge-lu-you-userscontroller" target="_blank">Ruby &#x7A0B;&#x5E8F;&#x5458;&#x5B66;&#x4E60; laravel &#x6846;&#x67B6;&#x7B14;&#x8BB0; (3)-&#x7B2C;&#x4E00;&#x4E2A;&#x8DEF;&#x7531; UsersController</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="1.html" class="navigation navigation-prev " aria-label="Previous page: 1. php 开发环境安装">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="3.html" class="navigation navigation-next " aria-label="Next page: 3. 第一个路由 UsersController">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2. 跑 laravel 的 hello world","level":"1.3","depth":1,"next":{"title":"3. 第一个路由 UsersController","level":"1.4","depth":1,"path":"chapters/3.md","ref":"chapters/3.md","articles":[]},"previous":{"title":"1. php 开发环境安装","level":"1.2","depth":1,"path":"chapters/1.md","ref":"chapters/1.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapters/2.md","mtime":"2017-09-02T01:53:37.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-09-02T01:57:53.635Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

